﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.SpcManagement;

namespace Digitalmes.Model.SpcManagement
{
    /// <summary>
    /// 采样数据
    /// </summary>
	[Table("SimpleData")]

    [Display(Name = "_Model.SimpleData")]
    public class SimpleData : TopBasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._SimpleData._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._SimpleData._BatchId")]
        [Comment("批次号")]
        public string BatchId { get; set; }
        [Display(Name = "_Model._SimpleData._Sn")]
        [Comment("追溯码")]
        public string Sn { get; set; }
        [Display(Name = "_Model._SimpleData._SimpleValue")]
        [Comment("测量值")]
        [Precision(18,3)]
        [Required(ErrorMessage = "Validate.{0}required")]
        public decimal? SimpleValue { get; set; }
        [Display(Name = "_Model._SimpleData._SimpleTime")]
        [Comment("采样时间")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public DateTime? SimpleTime { get; set; }
        [Display(Name = "_Model._SimpleData._OpId")]
        [Comment("工序")]
        public long? OpId { get; set; }
        [Display(Name = "_Model._SimpleData._ProductId")]
        [Comment("产品")]
        public long? ProductId { get; set; }
        [Display(Name = "_Model._SimpleData._Sheet")]
        [Comment("表单")]
        public SpcAnalysis Sheet { get; set; }
        [Display(Name = "_Model._SimpleData._Sheet")]
        [Comment("表单")]
        public long? SheetId { get; set; }
        [Display(Name = "_Model._SimpleData._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
